<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js"></script>
  </head>
  <body>
    <canvas id="canvas"></canvas>

    <img id="img" src="" alt="" />

    <script>
      QRCode.toDataURL('I am a pony!', function (err, url) {
        console.log(url)
        document.getElementById('img').src = url
      })

      // QRCode.toCanvas(document.getElementById('canvas'), 'sample text', function (error) {
      //   if (error) console.error(error)
      //   console.log('success!')
      // })
    </script>
  </body>
</html>
